package com.train.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author cxg
 * 项目类型：话术跟读，脱稿演练，模拟对话
 * 101-AI话术切片，102-话术跟读，103-脱稿演练，104-模拟对话，105-智能复习
 */

@Getter
@AllArgsConstructor
public enum ProjectTypeEnum implements ICommonEnum<Integer>  {

    AI_SLICING(101, "AI话术切片"),
    READING(102, "话术跟读"),
    PRACTICE(103, "脱稿演练"),
    SIMULATED(104, "模拟对话"),
    SMART_REVIEW(105, "智能复习")
    ;

    private Integer code;

    private String remark;

    public static ProjectTypeEnum getByCode(Integer code) {
        return Arrays.stream(ProjectTypeEnum.values())
                .filter(projectType -> projectType.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }

    /* 可选：返回 Map<code, remark> */
    public static Map<Integer, String> toCodeRemarkMap() {
        return Arrays.stream(values())
                .collect(Collectors.toMap(ProjectTypeEnum::getCode, ProjectTypeEnum::getRemark));
    }
}
